namespace LabChecker.Migrations
{
    using System.Data.Entity.Migrations;
    
    public partial class Subjects : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "Subjects",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(nullable: false, maxLength: 4000),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "Tasks",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Description_Title = c.String(nullable: false, maxLength: 4000),
                        Description_Problem = c.String(nullable: false, maxLength: 4000),
                        Description_Input = c.String(nullable: false, maxLength: 4000),
                        Description_Output = c.String(nullable: false, maxLength: 4000),
                        Subject_Id = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("Subjects", t => t.Subject_Id, cascadeDelete: true)
                .Index(t => t.Subject_Id);
            
            CreateTable(
                "TestCases",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Input = c.String(nullable: false, maxLength: 4000),
                        Answer = c.String(nullable: false, maxLength: 4000),
                        IsExample = c.Boolean(nullable: false),
                        ErrorMessage = c.String(maxLength: 4000),
                        Task_Id = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("Tasks", t => t.Task_Id, cascadeDelete: true)
                .Index(t => t.Task_Id);
            
        }
        
        public override void Down()
        {
            DropIndex("TestCases", new[] { "Task_Id" });
            DropIndex("Tasks", new[] { "Subject_Id" });
            DropForeignKey("TestCases", "Task_Id", "Tasks");
            DropForeignKey("Tasks", "Subject_Id", "Subjects");
            DropTable("TestCases");
            DropTable("Tasks");
            DropTable("Subjects");
        }
    }
}
